public class Thread_daemon {
    public static void main(String[] args) {
        God god = new God();
        Me me = new Me();
        //启动 God
        Thread thread = new Thread(god);
        thread.setDaemon(true);//设置为 守护进程
        thread.start();
        //启动 Me
        new Thread(me).start();
    }

}

class God implements Runnable{

    @Override
    public void run() {
        while (true){
            System.out.println("守护");
        }
    }
}

class Me implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 365; i++) {
            System.out.println("活着"+i);
        }
        System.out.println("BYE,world!");
    }
}
